package com.zmc.order.controller;

import java.util.List;
import java.util.Map;

import com.zmc.common.utils.poi.ExcelUtil;
import com.zmc.order.infrastructure.bean.query.ReturnInfoQuery;
import com.zmc.order.infrastructure.bean.vo.RefundInfoVo;
import com.zmc.order.infrastructure.entity.RefundInfoEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.zmc.order.infrastructure.service.RefundInfoService;
import com.zmc.common.utils.PageUtils;
import com.zmc.common.utils.R;

import javax.servlet.http.HttpServletResponse;


/**
 * 退款信息
 *
 * @author zmc
 * @email 
 * @date 2024-10-09 14:52:02
 */
@RestController
@RequestMapping("/return/info")
public class RefundInfoController {
    @Autowired
    private RefundInfoService refundInfoService;

    /**
     * 列表
     */
    @PostMapping("/list")
    public R list(@RequestBody ReturnInfoQuery query){
        return R.page(refundInfoService.queryPage(query));
    }

    @PostMapping("/export")
    public void export(HttpServletResponse response, ReturnInfoQuery query) {
        List<RefundInfoEntity> list = refundInfoService.selectList(query);
        ExcelUtil<RefundInfoEntity> util = new ExcelUtil<>(RefundInfoEntity.class);
        util.exportExcel(response, list, "退款信息");
    }

    @PostMapping("/info")
    public R info(@RequestBody RefundInfoVo vo){
        return R.ok(refundInfoService.getByOrderSn(vo.getOrderSn()));
    }

}
